package com.dayuanit.dy15.ebook.bookshop.controller;

import com.dayuanit.dy15.ebook.bookshop.dto.NavigationDTO;
import com.dayuanit.dy15.ebook.bookshop.dto.ResponseDTO;
import com.dayuanit.dy15.ebook.bookshop.service.NavigationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class UserController {

    @Autowired
    private NavigationService navigationService;

    @RequestMapping("/user/index")
    public String index() {
        System.out.println(">>>>>index()");
        return "hello world";
    }

    @RequestMapping("/user/getNav")
    public ResponseDTO getNav() {
        List<NavigationDTO> navigationDTOS = navigationService.listAllNavigation();
        return ResponseDTO.sucess(navigationDTOS);
    }
}
